home *** CD-ROM | disk | FTP | other *** search
- on mouseDown me
- set xCenter to ((the left of sprite 4 + the right of sprite 4) / 2) + 1
- set yCenter to ((the top of sprite 4 + the bottom of sprite 4) / 2) + 2
- set radius to the width of sprite 4 / 2
- set the cursor of sprite the spriteNum of me to [member "Closed Hand", member "Closed Hand Mask"]
- repeat while the stillDown
- set mx to the mouseH
- set my to the mouseV
- set xAtMouse to mx - xCenter
- set yAtMouse to my - yCenter
- if xAtMouse <> 0 then
- set angleAtMouse to atan(float(abs(yAtMouse)) / float(abs(xAtMouse)))
- if angleAtMouse = 0 then
- set yAtCircle to 0
- set xAtCircle to radius * (xAtMouse / abs(xAtMouse))
- else
- set yAtCircle to sin(angleAtMouse) * float(radius) * (yAtMouse / abs(yAtMouse))
- set xAtCircle to cos(angleAtMouse) * float(radius) * (xAtMouse / abs(xAtMouse))
- end if
- else
- set xAtCircle to 0
- if yAtMouse <> 0 then
- set yAtCircle to radius * (yAtMouse / abs(yAtMouse))
- else
- set yAtCircle to radius
- end if
- end if
- set the locH of sprite the clickOn to xCenter + xAtCircle
- set the locV of sprite the clickOn to yCenter + yAtCircle
- drawLine(6, yCenter, xCenter, the locV of sprite the clickOn, the locH of sprite the clickOn)
- set dy to float(yCenter - the locV of sprite the clickOn)
- set dy to -dy
- set dx to float(xCenter - the locH of sprite the clickOn)
- if dx = 0 then
- if dy < 0 then
- set theta1 to float(1.5 * PI)
- else
- set theta1 to float(PI / 2.0)
- end if
- else
- if dx > 0 then
- set theta1 to float(atan(float(dy / dx)))
- if theta1 < 0 then
- set theta1 to float(theta1) + (2.0 * PI)
- end if
- else
- set theta1 to float(atan(float(dy / dx))) + PI
- end if
- end if
- set the floatPrecision to 2
- if theta1 > PI then
- set theta1 to theta1 - PI
- else
- set theta1 to theta1 + PI
- end if
- set temp to theta1 * 180.0 / PI
- if temp = 360.0 then
- put "0.0" into field "theta"
- else
- put temp into field "theta"
- end if
- if dx <> 0 then
- put float(field "R") * float(cos(theta1)) into field "X1"
- else
- put "0.0" into field "X1"
- end if
- if (field "theta" > 90) and (field "theta" <= 270) then
- put 180.0 - field "theta" into field "theta"
- end if
- if (field "theta" > 270) and (field "theta" < 360) then
- put -(360.0 - field "theta") into field "theta"
- end if
- put float(field "R") * float(sin(theta1)) into field "Y1"
- put "(" & field "X1" & "," & field "Y1" & ")" into field "x-y"
- put float(field "Y1" / field "R") into field "YR"
- put PI / 180.0 * field "theta" & " rad." into field "Rad"
- put field "theta" & "deg" into field "thetaD"
- updateStage()
- end repeat
- set the cursor of sprite the spriteNum of me to [member "Hand", member "Hand Mask"]
- end
-
- on beginSprite me
- set the cursor of sprite the spriteNum of me to [member "Hand", member "Hand Mask"]
- put "2" into field "R"
- put "(1.88, 0.67)" into field "x-y"
- put "0.34" into field "YR"
- put "0.34 rad." into field "Rad"
- put "19.70" & "deg" into field "thetaD"
- end
-
- on endSprite me
- set the cursor of sprite the spriteNum of me to 0
- end
-